//
//  TestGridPage.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2022/2/22.
//  Copyright © 2022 moon. All rights reserved.
//

#import "TestGridPage.h"
#import "TestGridPageTableViewCell.h"
#import "Menu.h"
#import "TestCollectionPageFlowTableViewCell_1.h"
#import "TestCollectionPageFlowTableViewCell_2.h"
#import "TestCollectionPageFlowTableViewCell_3.h"
#import "TestCollectionPageFlowTableViewCell_4.h"
#import "TestCollectionPageFlowTableViewCell_5.h"
#import "TestCollectionPageFlowTableViewCell_6.h"
#import "TestCollectionPageFlowTableViewCell_7.h"
@interface TestGridPage ()

@end

@implementation TestGridPage
+ (MKTFuncItem *)funcItem{
    return [MKTFuncItem funcWithName:@"GridPage集合2" viewControllerClass:self];
}
- (void)viewDidLoad{
    [super viewDidLoad];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    [self __reloadData];

}
- (void)__reloadData{
    [self.model removeAllSectionModels];
    //empty
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:nil cellClass:[TestGridPageTableViewCell class]]];
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:nil cellClass:[TestCollectionPageFlowTableViewCell_1 class]]];
    {
        MKUITableViewCellModel *cm = [MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestGridPageTableViewCell class]];
        cm[@"currentPage"] = @(1);
        [self.model addCellModel:cm];
    }
    {
        MKUITableViewCellModel *cm = [MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestGridPageTableViewCell class]];
        cm[@"currentPage"] = @(2);
        [self.model addCellModel:cm];
    }

    {
        MKUITableViewCellModel *cm = [MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:1 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_7 class]];
        cm[@"currentPage"] = [NSIndexPath indexPathForItem:1 inSection:0];
        [self.model addCellModel:cm];
    }
    {
        MKUITableViewCellModel *cm = [MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:1 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_1 class]];
        cm[@"currentPage"] = [NSIndexPath indexPathForItem:0 inSection:0];
        [self.model addCellModel:cm];
    }

    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:1 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_2 class]]];
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenus] cellClass:[TestCollectionPageFlowTableViewCell_2 class]]];

    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_3 class]]];
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_4 class]]];
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_5 class]]];
    [self.model addCellModel:[MKUITableViewCellModel modelWithValue:[Menu sharedMenusWithCount:10 haveAddMenu:NO] cellClass:[TestCollectionPageFlowTableViewCell_6 class]]];
    
    [self.model reloadTableViewData];
}

@end
